﻿@using KMF.Utility
@using KMF.WebUI.CustomHelpers
@using KMF.WebUI.Models
@model List<KMF.Common.ProductRateByCateTopListPagingDto>
<div class="pro-hot-day">
    @*<img src="/images/icons/gif-load-small.gif" width="30" height="30" alt="loading-product hot" class="loadingProducthot" />*@
    <div class="p-d-header">
        <i class="tim-1"></i><i class="tim-2"></i>
        GIÁ RẺ <span class="p-text">MỖI NGÀY</span>
    </div>
    @if (Model.Any())
    {
        <div class="productHot-item">
            <input type="hidden" name="hidPageProductHot" value="@ViewBag.CurrentPage" />
            <input type="hidden" name="hidTotalPageProductHot" value="@ViewBag.TotalPage" />
            <div class="ProductHotPlc">
                @foreach (var item in Model)
                {
                    var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
                    if (item.CreateDate.Date >= DateTime.Now.Date)
                    {
                        <input type="hidden" value="@item.CreateDate.ToString("yyyy-MM-dd") 00:00:00" class="timedown" />
                    }
                    <div class="p-d-clock">
                        @*@item.CreateDate.ToString("yyyy-MM-dd hh:mm:ss")<input type="hidden" value="2014-3-13 20:00" class="timedown" />*@
                        @*<span>19:12:09</span>*@
                        @*<span>1</span>
                            <span>9</span>
                            :
                            <span>0</span>
                            <span>6</span>
                            :
                            <span>4</span>
                            <span>2</span>*@
                    </div>
                    <div class="p-d-body">
                        <div class="p-d-img">
                            @if (item.PromotionPrice > 0)
                            {
                                <span class="p-d-promo">-@item.DiscountPercentage.ToString("#,#")%</span>
                            }
                            <a href="@pDetailLink">
                                <img src="@item.ImagePath.ImagePathThumb(125, 125)" width="125" height="125" alt="@item.Name" />
                            </a>
                        </div>
                        <div class="p-d-name">
                            <div style="line-height: 13px; margin-top: 5px;text-align: left; bottom: 15px; position: absolute;">
                                @{
                            string StarPercent = "0";
                            if (item.AverageRate > 0)
                            {
                                StarPercent = (Convert.ToDouble(item.AverageRate) * 100 / 5).ToString("#.#").Replace(',', '.');
                            }
                                }
                                <span class="itm-ratStars inlineBlocka"><span style="width: @StarPercent%;" class="itm-ratStars itm-ratRating"></span></span>
                            </div>
                            <a href="@pDetailLink" title="@item.Name">@item.Name</a>
                        </div>
                        @if (item.PromotionPrice > 0)
                        {
                            <div class="p-d-price-root">
                                @item.Price.ToString("##,###,###") đ
                            </div>
                            <div class="p-d-price-curent">
                                <span class="price-red">
                                    @item.PromotionPrice.ToString("##,###,###") đ
                                </span>
                            </div>
                        }
                        else
                        {
                            <div class="p-d-price-curent">
                                <span class="price-red">
                                    @item.Price.ToString("##,###,###") đ
                                </span>
                            </div>
                        }

                    </div>

                }
            </div>
            <span class="price-pagging">@ViewBag.CurrentPage/@ViewBag.TotalPage</span>
            <a href="javascript:void(0);" rel="nofollow" class="hot-pag-back" title="quay lại">back</a>
            <a href="javascript:void(0);" rel="nofollow" class="hot-pag-next" title="xem tiếp">next</a>
        </div>
    }
</div>
